// EventHandlerObserverPattern.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "DynamicArray.h"
#include "EventHandler.h"

int _tmain(int argc, _TCHAR* argv[])
{
	int Value = 0;

	// event handler
	EventHandler Handler;

	// Init event handler
	InitEventHandler(&Handler);

	// Register observer (this could be part of a stuct or other software component, in C++ we can use objects 
	// and register a member function of that object)
	RegisterObserver(&Handler, HandlerFunction);

	// Register another observer
	RegisterObserver(&Handler, HandlerFunction);

	Value++;

	//Fire event
	UpdateHandler(&Handler, Value);
	return 0;
}

